package com.ruoyi.coal.modules.publicAPI.service.impl;

import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.symmetric.AES;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;

@DataSource(value = DataSourceType.SLAVE)
public class MybatisColumnEncrypted {
    private static final String AES_KEY = "VoEZBvRv03hCDky3";

    private static final AES AES = SecureUtil.aes("VoEZBvRv03hCDky3".getBytes());

    public static String encryptColumn(String columnValue) {
        return AES.encryptHex(columnValue);
    }

    public static String decodeColumn(String columnValue) {
        return AES.decryptStr(columnValue);
    }
}
